using System;
using System.Linq;
using Domain;
using Domain.Repository;
using Infrastructure.Hibernate;

namespace Database.Repository
{
    public class UserRepository:BaseRepository<User>,IUserRepository
    {
        public UserRepository(ISessionProvider sessionProvider) : base(sessionProvider)
        {
        }

        public User GetByName(string username)
        {
            return Session.CreateCriteria<User>().List<User>().FirstOrDefault(x => x.Name == username);
        }
    }
}